package com.ushine.design.design.c_behavioral_pattern.k_visitor.b_example;

/**
 * 人力资源部
 *
 * @author yls
 */
public class HRDepartment extends Department {

    @Override
    public void visit(FulltimeEmployee employee) {
        int workTime = employee.getWorkTime();
        System.out.println("正式员工：" + employee.getName() + "，实际工作时间为：" + workTime + "小时。");
        if (workTime > 40) {
            System.out.println("正式员工：" + employee.getName() + "，加班时间为：" + (workTime - 40) + "小时。");
        } else if (workTime < 40) {
            System.out.println("正式员工：" + employee.getName() + "，请假时间为：" + (40 - workTime) + "小时。");
        }
    }

    @Override
    public void visit(ParttimeEmployee employee) {
        int workTime = employee.getWorkTime();
        System.out.println("临时工：" + employee.getName() + "，实际工作时间为：" + workTime + "小时。");
    }

}
